package com.yunshipei.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.yunshipei.common.Globals;
import com.yunshipei.db.DatabaseUtil;
import com.yunshipei.manager.YspPreferences;
import com.yunshipei.model.NotifyInfo;

import java.util.List;

/**
 * Created by cike on 16/7/12.
 */
public class StartUpReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        Log.e("StartUpReceiver", "-------- 重设闹钟提醒 ---------");
        //重新设置闹钟
        String uuid = YspPreferences.getInstance().getSharedPreferences().getString(Globals.UUID, "");
        List<NotifyInfo> list = new DatabaseUtil().queryNotifiAll(true, uuid);
        if (list == null) return;
        for (NotifyInfo notifyInfy : list) {
            notifyInfy.setAlarm(context);
        }

    }
}
